package org.aksw.xoperator.security;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

/**
 * represents the security configuration of the agent. Manages who can chat and
 * send p2p messages to the agent. the chat configuration refers either to the
 * main account (personal agent) or the main account (group agent).
 * 
 */
public class SecurityConfiguration {

	private Pattern allowGroupsToChat;

	private List<Pattern> allowUsersToChat;

	private Pattern allowGroupsP2PQuery;

	private List<Pattern> allowUsersP2PQuery;

	private String accessDeniedChatMessage;

	private String AccessDeniedP2PMessage;
	
	

	/**
	 * a java.util.regex.Pattern that when it matches any of the groups a user
	 * is associated to will allow the user to chat with the agent
	 * 
	 * @return true if the pattern matches any one of the groups of the user.
	 */
	public Pattern getAllowGroupsToChat() {
		return allowGroupsToChat;
	}

	public void setAllowGroupsToChat(Pattern allowGroupsToChat) {
		this.allowGroupsToChat = allowGroupsToChat;
	}
	/**
	 * a List of java.util.regex.Pattern that describe the users allowed to chat with the agent.
	 * when any one of the patterns matches the jabber id (jid) of the communicating user 
	 * 
	 * @return true if the pattern matches any one of the groups of the user.
	 */
	public List<Pattern> getAllowUsersToChat() {
		return allowUsersToChat;
	}

	public void setAllowUsersToChat(List<Pattern> allowUsersToChat) {
		this.allowUsersToChat = allowUsersToChat;
	}

	public Pattern getAllowGroupsP2PQuery() {
		return allowGroupsP2PQuery;
	}

	public void setAllowGroupsP2PQuery(Pattern allowGroupsP2PQuery) {
		this.allowGroupsP2PQuery = allowGroupsP2PQuery;
	}

	public List<Pattern> getAllowUsersP2PQuery() {
		return allowUsersP2PQuery;
	}

	public void setAllowUsersP2PQuery(List<Pattern> allowUsersP2PQuery) {
		this.allowUsersP2PQuery = allowUsersP2PQuery;
	}

	public String getAccessDeniedChatMessage() {
		return accessDeniedChatMessage;
	}

	public void setAccessDeniedChatMessage(String accessDeniedChatMessage) {
		this.accessDeniedChatMessage = accessDeniedChatMessage;
	}

	public String getAccessDeniedP2PMessage() {
		return AccessDeniedP2PMessage;
	}

	public void setAccessDeniedP2PMessage(String accessDeniedP2PMessage) {
		AccessDeniedP2PMessage = accessDeniedP2PMessage;
	}

}
